package com.sk.bilibili.other;

import com.sk.bilibili.bean.Danmu;
import com.sk.bilibili.utils.DanmuUtils;

import java.util.List;

import master.flame.danmaku.danmaku.model.BaseDanmaku;
import master.flame.danmaku.danmaku.model.IDanmakus;
import master.flame.danmaku.danmaku.model.android.Danmakus;
import master.flame.danmaku.danmaku.parser.BaseDanmakuParser;

public class BiliBiliDanmuParser extends BaseDanmakuParser {

    @Override
    protected IDanmakus parse() {
        Danmakus danmakus = new Danmakus();
        if(mDataSource==null)return danmakus;
        BiliBiliDanmuSource danmuSource= (BiliBiliDanmuSource) mDataSource;
        List<Danmu> list = danmuSource.data();
        for (Danmu danmu:list){
            BaseDanmaku danmaku = DanmuUtils.toDanmaku(danmu, mContext, false);
            danmaku.setTimer(mTimer);
            danmakus.addItem(danmaku);
        }
        return danmakus;
    }

}